#include "triangle.h"

Triangle::Triangle(std::vector<double> &data)
{
    x0 = data[0];
    y0 = data[1];
    x1 = data[2];
    y1 = data[3];
    x2 = data[4];
    y2 = data[5];
}

void Triangle::setCoord(std::vector<double> &data)
{
    x0 = data[0];
    y0 = data[1];
    x1 = data[2];
    y1 = data[3];
    x2 = data[4];
    y2 = data[5];
}

std::vector<double> Triangle::getCoord()
{
    std::vector<double> data;
    data.push_back(x0);
    data.push_back(y0);
    data.push_back(x1);
    data.push_back(y1);
    data.push_back(x2);
    data.push_back(y2);
    return data;
}

void Triangle::shift(double shiftX, double shiftY)
{
    x0 += shiftX;
    y0 += shiftY;
    x1 += shiftX;
    y1 += shiftY;
    x2 += shiftX;
    y2 += shiftY;
}

typeFigure Triangle::type()
{
    return triangle;
}

std::string Triangle::dataToString()
{
    return "Triangle " + std::to_string(x0) + " " + std::to_string(y0) + " "
                       + std::to_string(x1) + " " + std::to_string(y1) + " "
                       + std::to_string(x2) + " " + std::to_string(y2);
}
